
//点击就显示结果 ,抽奖命名lottery  模板[ 神灯, ] ,
var lottery = {
    isShow:false,  // 显示toast
    win:true,   // 默认中奖, 没中奖就显示没中奖的div
    prizeItem: false,  // 奖品
    lookPrize:false,
    prizeYes: function () {  //中奖
        const that = this
        setTimeout(function () {
            that.isShow = !that.isShow  //显示toast
            that.prizeItem = !that.prizeItem // 显示中奖信息
        },1500)
    },
    // 查看奖品按钮
    showPrize: function () {
        const that = this
        that.prizeItem = !that.prizeItem  //  关闭中奖信息
        that.lookPrize = !that.lookPrize  //  显示奖品
    },
    again: function () {
        const that = this
        setTimeout(function () {
            that.win = !that.win
        },1500)
    },
    close: function () {
        const that = this
        that.isShow = !that.isShow
        that.lookPrize = !that.lookPrize  //关闭后重置奖品显示为false,不然下次打开会直接显示div
    }
}


//翻牌后显示结果 , 命名 flop
var flop = {
    clickNum:1,
    isShow:false,  // 显示toast
    win:true,   // 默认中奖
    prizeItem: false,  // 奖品
    prizeList:[
        {id:0,fan:0,img:''},
        {id:1,fan:0,img:''},
        {id:2,fan:0,img:'../common/img/prize.jpg'},
        {id:3,fan:0,img:''},
        {id:4,fan:0,img:''},
        {id:5,fan:0,img:''}
    ],
    prizeYes: function () {  //中奖
        const that = this
        setTimeout(function () {
            that.isShow = !that.isShow  //显示toast
            that.prizeItem = !that.prizeItem // 显示中奖信息
        },1500)
    },
    prizeNo: function () { //没中奖
        const that = this
        that.isShow = !that.isShow  //显示toast
        that.win = !that.win
    },
    // 查看奖品按钮
    showPrize: function () {
        const that = this
        that.isShow = !that.isShow  //  关闭toast
        that.prizeItem = !that.prizeItem  //  显示奖品
    },
    //再来一次
    again: function () {
        const that = this
        setTimeout(function () {
            that.isShow = !that.isShow  //  关闭toast
            that.win = !that.win  //重置div显示
            // 点击再来一次按钮, 重置为卡牌背面
            for (let x of that.prizeList) {
                x.fan = 0
            }
            //重置点击次数为1
            that.clickNum = 1
        },500)
    },
    close: function () {
        const that = this
        that.isShow = !that.isShow
        that.prizeItem = !that.prizeItem  //关闭后重置奖品显示为false,不然下次打开会直接显示div
        // that.win = !that.win
    }
}



//1.5秒后显示结果 ,抽奖命名lotteryBox  模板[ 抽奖箱, ] ,
var lotteryBox = {
    isShow:false,  // 显示toast
    win:false,   // 默认中奖, 没中奖就显示没中奖的div
    lose:false,
    count:3,
    getResult:function () {  //根据接口设置是否抽奖,   中奖win设置为true, 否则显示失败信息
        const that = this
        if(that.count <= 0 ) { return}
        that.count--

        that.win = !that.win   // 中奖设置win为true

        if(that.win){
            that.yes()
        }else{
            setTimeout(function () {
                that.lose = true // 未中奖设置 lose 为true
                setTimeout(function () {
                    that.lose = false
                },2000)
            },1000)
        }
    },
    yes: function () {  //中奖
        const that = this
        setTimeout(function () {
            that.isShow = !that.isShow  //显示toast
        },1500)
    },
    again: function () {  //没中奖
        const that = this
        setTimeout(function () {

        },1500)
    },
    close: function () {
        const that = this
        that.isShow = !that.isShow

    }
}


//1.5秒后显示结果 ,抽奖命名luckyBag  模板[ 拆福袋, ] ,
/*var luckyBags = {
    isShow:false,  // 显示toast
    win:false,   // 默认中奖, 没中奖就显示没中奖的div
    lose:false,
    count:3,
    pageHome:true,
    getResult:function () {  //根据接口设置是否抽奖,   中奖win设置为true, 否则显示失败信息
        const that = this

        if(that.count <= 0 ) { return}
        that.count--

        that.win = !that.win   // 中奖设置win为true

        if(that.win){
            that.yes()
        }else{
            setTimeout(function () {
                that.lose = true // 未中奖设置 lose 为true
                setTimeout(function () {
                    that.lose = false
                },2000)
            },1000)
        }
    },
    yes: function () {  //中奖
        const that = this
        setTimeout(function () {
            that.isShow = !that.isShow  //显示toast
        },1500)
    },
    again: function () {  //没中奖
        const that = this
        setTimeout(function () {

        },1500)
    },
    close: function () {
        const that = this
        that.isShow = !that.isShow

    }
}*/


